Make by Kate Hartman

Make by Kate Hartman

Author:Kate Hartman
Language: eng
Format: epub
Tags: COMPUTERS / Hardware / General
ISBN: 9781449336509
Publisher: Maker Media, Inc
Published: 2014-08-11T16:00:00+00:00


map(lightSensorValue, 25, 940, 0, 255)

Figure 7-14. Mapping a value from 25–940 to 0–255

If you are working with a LilyPad light sensor as your input and using the mapped value to control an LED on the analog output pin, you would have an LED that brightens and dims in a way that mimics the conditions of the room. If you wanted to inverse the relationship so that the LED gets brighter as the room gets darker, you can simply flip the to values, as illustrated in Figure 7-15:

map(lightSensorValue, 25, 940, 255, 0)



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.